import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userInfo: '',
    channelsList: [],
    name: '张三',
    age: 14
  },
  mutations: {
    setUserInfo (state, value) {
      state.userInfo = value
    },
    setList (state, value) {
      state.channelsList = value
    },
    setName (state, value) {
      state.name = value
    },
    setAge (state, value) {
      state.age = value
    }
  },
  actions: {},
  modules: {},
  getters: {
    getName (state) {
      return '男人' + state.name
    },
    getAge (state) {
      return '20' + state.age
    }
  }
})
